import request from '@/utils/request'

/**
 * 获取报修类型信息接口
 * @param {Object} param: id
 * @return Promise
 */
export const getRepairTypeInfoAPI = (id) => {
  return request({
    url: `/common/repair_type/${id}`
  })
}

/**
 * 获取报修类型列表接口
 * @return Promise
 */
export const getRepairTypeListAPI = () => {
  return request({
    url: '/common/repair_type/'
  })
}

/**
 * 添加报修类型
 * @param {Object} data: { name: 名称, pid, repairer_type: 维修人员类型 }
 * @return Promise
 */
export const addRepairTypeAPI = (data) => {
  return request({
    url: '/repair_type/',
    method: 'POST',
    data
  })
}

/**
 * 修改报修类型信息
 * @param {Object} data: { name: 名称 }
 * @return Promise
 */
export const updateRepairTypeAPI = (data) => {
  return request({
    url: '/repair_type/',
    method: 'PATCH',
    data
  })
}

/**
 * 删除报修类型
 * @param id
 * @return Promise
 */
export const deleteRepairTypeAPI = (id) => {
  return request({
    url: `/repair_type/${id}`,
    method: 'DELETE'
  })
}
